package net
{
	import flash3.net.ByteArrayPlus;
	import flash3.net.MsgPacket;
	
	import vo.ServerRunInfo;
	import model.*;

	public class RoomGroup extends MessageGroup
	{
		//房间数据包
		public static const MDM_GR_SERVER_INFO	:uint		=	211;									//房间信息
		public static const SUB_GR_ONLINE_COUNT_INFO:uint		=	100;									//在线信息
		public static const SUB_GR_SUPPLY_LINE:uint			=	221;									//补给线,低于补给线，需要补给
		public static const SUB_GR_RUNINFO_REQ:uint			=	300;									//服务器运行信息请求
		public static const SUB_GR_RUNINFO:uint				=   301										//服务器运行信息


			
		public function RoomGroup()
		{
			super();
		}
		
		override public function defMessage():void
		{
			addMessage(new MessageDef(MDM_GR_SERVER_INFO, SUB_GR_SUPPLY_LINE, "需要补给", onSupplyLine));
			addMessage(new MessageDef(MDM_GR_SERVER_INFO, SUB_GR_RUNINFO_REQ, "运行信息", onRunInfoRequest));
			addMessage(new MessageDef(MDM_GR_SERVER_INFO, SUB_GR_RUNINFO, "运行信息", onRunInfoReply));
		}
		
		public function onSupplyLine(packet:MsgPacket):void
		{
			var bap:ByteArrayPlus = packet._data;
			var count:uint = bap.readInt();
		}
		public function onRunInfoRequest(packet:MsgPacket):void
		{
			var bap:ByteArrayPlus = packet._data;
			bap.writeUnsignedInt(packet._parm);
		}
		public function onRunInfoReply(packet:MsgPacket):void
		{
			var bap:ByteArrayPlus = packet._data;
			var serverRunInfo:ServerRunInfo = GameModel.i.serverRunInfo;
			serverRunInfo.read(bap);
		}
	}
}